/**
 * Created by dukes on 2015/10/20.
 */
//module game{
    class ProduceItemRender extends eui.ItemRenderer{
        private img_hehe:eui.Image;
        constructor(){
            super();
            this.skinName = "pet.ProduceItemRenderSkin";
        }
        public partAdded(name:string, instance:any){
            super.partAdded(name, instance);
            if( name == "img_hehe"){
                this.img_hehe = instance;
            }
        }

        public dataChanged(){
            super.dataChanged();
            this.img_hehe.source = this.data["url"];
            if( this.data["action"] != ""){
                this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.doAction, this);
            }else{
                this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.doAction, this);
            }
        }
        private doAction(evt:egret.TouchEvent){
            var action = this.data["action"];
            if( action == "getout"){
                SceneMgr.getInstance().switchScene(SceneMgr.SCENE_GETOUT);
            }else if( action == "shop"){
                SceneMgr.getInstance().switchScene(SceneMgr.SCENE_SHOP);
            }else if( action == "bath"){

            }else if( action == "dec"){
                SceneMgr.getInstance().switchScene(SceneMgr.SCENE_DECORATE);
            }
            BuffPanel.getInstance().hide();
        }
    }
//}